// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_HR_ATTENDANCE_CARD_LOSS
// * CreateDate    : 2011/11/7 12:58:39
// * Creater       : CodeSmith
// * LastChangeDate: 2011/11/7 12:58:39
// * LastChanger   : 2011/11/7 12:58:39
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;
using ESOL.Common;

namespace ESOL.Business.Hr
{
/// <summary>
    /// HrAttendanceCardLoss
    /// </summary>
    public partial class HrAttendanceCardLossBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objHrAttendanceCardLossEntity">Entity</param>
        /// <returns>Entity</returns>
        public static HrAttendanceCardLossEntity GetHrAttendanceCardLoss(HrAttendanceCardLossEntity objHrAttendanceCardLossEntity)
        {
            return DataAccess.SelectSingle<HrAttendanceCardLossEntity>(objHrAttendanceCardLossEntity);
        }
        public static DataTable GetByCondition(string condition, string orderBy, string rowCount)
        {
            string sql = CommonFunctions.GetSelect(rowCount) + @"ACL.*, P.NAME_CN AS PERSON_NAME, D.DEPARTMENT_NAME
                                FROM HR_ATTENDANCE_CARD_LOSS ACL
                                LEFT JOIN MST_PERSON P ON P.PERSON_ID = ACL.PERSON_ID
                                LEFT JOIN MST_DEPARTMENT D ON D.DEPARTMENT_ID = ACL.DEPARTMENT_ID
                                WHERE 1=1 ";
            if (string.IsNullOrEmpty(condition) == false)
            {
                sql += condition;
            }
            if (string.IsNullOrEmpty(orderBy) == false)
            {
                sql += " ORDER BY " + orderBy;
            }
            DataSet ds = DataAccess.SelectDataSet(sql);
            if (ds != null && ds.Tables.Count > 0)
            {
                return ds.Tables[0];
            }
            return null;
        }
        public static HrAttendanceCardLossEntity GetById(string cardLossId)
        {
            if (string.IsNullOrEmpty(cardLossId))
            {
                return null;
            }
            HrAttendanceCardLossEntity entity = new HrAttendanceCardLossEntity();
            entity.LossId = cardLossId;
            return DataAccess.SelectSingle<HrAttendanceCardLossEntity>(entity);
        }
        #endregion

        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objHrAttendanceCardLossEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertHrAttendanceCardLoss(HrAttendanceCardLossEntity objHrAttendanceCardLossEntity)
        {
            return DataAccess.Insert(objHrAttendanceCardLossEntity);
        }

        public static bool InsertHrAttendanceCardLoss(List<HrAttendanceCardLossEntity> objHrAttendanceCardLossEntityList)
        {
            return DataAccess.Insert(objHrAttendanceCardLossEntityList);
        }
        #endregion

        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objHrAttendanceCardLossEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateHrAttendanceCardLoss(HrAttendanceCardLossEntity objHrAttendanceCardLossEntity)
        {
            return DataAccess.Update(objHrAttendanceCardLossEntity);
        }

        public static bool UpdateHrAttendanceCardLoss(List<HrAttendanceCardLossEntity> objHrAttendanceCardLossEntityList)
        {
            return DataAccess.Update<HrAttendanceCardLossEntity>(objHrAttendanceCardLossEntityList);
        }
        #endregion

        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objHrAttendanceCardLossEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteHrAttendanceCardLoss(HrAttendanceCardLossEntity objHrAttendanceCardLossEntity)
        {
            return DataAccess.Delete(objHrAttendanceCardLossEntity);
        }

        public static bool DeleteHrAttendanceCardLoss(List<HrAttendanceCardLossEntity> objHrAttendanceCardLossEntityList)
        {
            return DataAccess.Delete<HrAttendanceCardLossEntity>(objHrAttendanceCardLossEntityList);
        }
        #endregion

        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetHrAttendanceCardLossAll()
        {
            return DataAccess.SelectAllDataSet<HrAttendanceCardLossEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<HrAttendanceCardLossEntity> GetHrAttendanceCardLossAllList()
        {
            return DataAccess.SelectAll<HrAttendanceCardLossEntity>();
        }
        #endregion
	}
	
	
}	

